<?php

/**
 * Users form base class.
 *
 * @method Users getObject() Returns the current form's model object
 *
 * @package    mysmartmanager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseUsersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'loginid'       => new sfWidgetFormInputHidden(),
      'loginname'     => new sfWidgetFormInputText(),
      'password'      => new sfWidgetFormInputText(),
      'name'          => new sfWidgetFormInputText(),
      'createdate'    => new sfWidgetFormDateTime(),
      'userrole'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Roles'), 'add_empty' => false)),
      'status'        => new sfWidgetFormInputText(),
      'emailaddress'  => new sfWidgetFormInputText(),
      'contactnumber' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'loginid'       => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'loginid', 'required' => false)),
      'loginname'     => new sfValidatorString(array('max_length' => 150)),
      'password'      => new sfValidatorString(array('max_length' => 150)),
      'name'          => new sfValidatorString(array('max_length' => 100)),
      'createdate'    => new sfValidatorDateTime(),
      'userrole'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Roles'))),
      'status'        => new sfValidatorInteger(),
      'emailaddress'  => new sfValidatorString(array('max_length' => 255)),
      'contactnumber' => new sfValidatorString(array('max_length' => 30)),
    ));

    $this->widgetSchema->setNameFormat('users[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Users';
  }

}
